let algorithms = require('./runtime-algorithms')

const menu = {
  edit: false,
  list: [
    {
      code: '01',
      name: 'XX类报表',
      children: [
        {
          id: 'aaaaaaaaaxxxxx1',
          name: 'XX用电量日报表'
        },
        {
          id: 'aaaaaaaaaxxxxx2',
          name: 'XX用电量周报表'
        },
        {
          id: 'aaaaaaaaaxxxxx3',
          name: 'XX用电量年报表'
        }
      ]
    },
    {
      code: '02',
      name: 'YY类报表',
      children: [
        {
          id: 'bbbbbbbbbxxxxx1',
          name: 'YY用电量日报表'
        },
        {
          id: 'bbbbbbbbbxxxxx2',
          name: 'YY用电量周报表'
        },
        {
          id: 'bbbbbbbbbxxxxx3',
          name: 'YY用电量年报表'
        }
      ]
    }
  ]
}

const data = {
  total: 10000,
  total1: 10000,
  list: [
    {date: '2017-08-09', v1min: 100, v1avg: 200, v1max: 300, v2min: 100, v2avg: 200, v2max: 300, v3min: 100, v3avg: 200, v3max: 300},
    {date: '2017-08-09', v1min: 100, v1avg: 200, v1max: 300, v2min: 100, v2avg: 200, v2max: 300, v3min: 100, v3avg: 200, v3max: 300},
    {date: '2017-08-09', v1min: 100, v1avg: 200, v1max: 300, v2min: 100, v2avg: 200, v2max: 300, v3min: 100, v3avg: 200, v3max: 300},
    {date: '2017-08-09', v1min: 100, v1avg: 200, v1max: 300, v2min: 100, v2avg: 200, v2max: 300, v3min: 100, v3avg: 200, v3max: 300},
    {date: '2017-08-09', v1min: 100, v1avg: 200, v1max: 300, v2min: 100, v2avg: 200, v2max: 300, v3min: 100, v3avg: 200, v3max: 300}
  ]
}
data.list.push({date: '2017-08-09', v1min: 100, v1avg: 200, v1max: 300, v2min: 100, v2avg: 200, v2max: 300, v3min: 100, v3avg: 200, v3max: 300})
data.list.map((item, index, arr) => {})
data.list.reduce((item1, item2) => {})

function reportCfgSet () {
  return {
    transName: 'fade',
    index: '01',
    menu: {
      edit: true,
      list: [
        {
          code: '01',
          name: 'XX类报表',
          children: [
            {
              id: 'aaaaaaaaaxxxxx1',
              name: 'XX用电量日报表'
            },
            {
              id: 'aaaaaaaaaxxxxx2',
              name: 'XX用电量周报表'
            },
            {
              id: 'aaaaaaaaaxxxxx3',
              name: 'XX用电量年报表'
            }
          ]
        },
        {
          code: '02',
          name: 'YY类报表',
          children: [
            {
              id: 'bbbbbbbbbxxxxx1',
              name: 'YY用电量日报表'
            },
            {
              id: 'bbbbbbbbbxxxxx2',
              name: 'YY用电量周报表'
            },
            {
              id: 'bbbbbbbbbxxxxx3',
              name: 'YY用电量年报表'
            }
          ]
        }
      ]
    }
  }
}

module.exports = {
  reportRunValue: function (config, startTime, endTime) {
    return new Promise((resolve, reject) => {
      algorithms.ConfigValue(config, startTime, endTime).then(result => {
        resolve(result)
      })
    })
  }
}
